#!/bin/sh
set -e

# Refresh GNU autotools toolchain.
echo Cleaning autotools files...
find . -type d -name autom4te.cache -print0 | xargs -0 rm -rf \;
find . -type f \( -name missing -o -name install-sh -o -name mkinstalldirs \
	-o -name depcomp -o -name configure -o -name config.sub -o -name config.guess \
	-o -name Makefile.in \) -print0 | xargs -0 rm -f

find src -type f \( -name '*.cpp' -o -name '*.c' -o -name '*.h' \) \
  -not -path 'src/icons/*' \
  -not -path 'src/normal_re/*' \
  -not -path 'src/test/*' \
  -not -path 'src/buildinfo.h' \
  -not -path 'src/svn.h' \
  -not -path 'src/paths.h' \
  -not -path 'src/filecache*' \
    | sort > po/POTFILES.in
#find src -type f \( -name '*.cpp' -o -name '*.h' -o -name '*.ui' \) -not -path 'src/icons/*' > po/POTFILES.in
#find src -type f \( -name '*.cpp' -o -name '*.h' -o -name '*.glade' \) > po/POTFILES.in

intltoolize -f -c --automake
aclocal -I m4
autoheader
automake -a
autoconf
